<%@ page import='java.util.List' %>
<%@ page import='javaweb.oa.bean.Dept' %>
<%@page contentType='text/html; charset=UTF-8' %>
<!doctype html>
<html>

	<head>
		<meta charset='utf-8'>
		<title>部门列表页面</title>
		<style type='text/css'>
			table{
				height:200px;
				width:350px;
				border:2px solid pink;
				border-collapse:collapse;
			}
			a{
				color:black;
				text-decoration:none;
			}
			a:hover{
				color:pink;
				text-decoration:underline;
				cursor:pointer;
			}
		</style>
		
	</head>

	<body>

	<%
		HttpSession session1 = request.getSession();
		String username = (String)session1.getAttribute("username");
	%>
	<h1>欢迎<%=username%></h1>
	<a href='<%=request.getContextPath()%>/user/exit'>安全退出系统</a>


		<h1 align='center'>部门列表</h1>
		<hr color='green'/>
			<table border='1px' align = 'center'>
				<tr>
					<th>序号</th>
					<th>部门编号</th>
					<th>部门名称</th>
					<th colspan='3'>操作</th>
				</tr>
				<%
					int i = 1;

					List<Dept> depts = (List)request.getAttribute("dept");
					//循环遍历
					for(Dept dept:depts){


				%>
				<tr>
					<td align='center'><%=i++%></td>
					<td align='center'><%=dept.getDeptno()%></td>
					<td align='center'><%=dept.getDname()%></td>
					<td align="center"><a href="<%=request.getContextPath()%>/dept/delete?deptno=<%=dept.getDeptno()%>">删除</a></td>
					<td align='center'><a href='<%=request.getContextPath()%>/dept/detail?flag=t&deptno=<%=dept.getDeptno()%>'>修改</a></td>
					<td align='center'><a href='<%=request.getContextPath()%>/dept/detail?flag=f&deptno=<%=dept.getDeptno()%>'>详情</a></td>
				</tr>
				<%
				}
				%>
			</table>
			<hr color='pink'/>
			<a href='${pageContext.request.contextPath}/add.jsp'>新增部门</a>
		
	</body>

</html>